<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="format-detection" content="telephone=no"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>直接注册</title>
    <link rel="stylesheet" href="../../fonts/font_awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../../js/mui/css/mui.min.css">
    <link rel="stylesheet" href="../../css/mui-app-style.css">
</head>
<body>
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-back mui-pull-left"></a>
    <h1 class="mui-title"><!--业绩--></h1>
</header>
<div class="mui-content">
    <h5 style="padding:8px 15px">替好友开通后，系统默认关联在您的账户名下</h5>
    <form class="mui-input-group">
        <div class="mui-input-row">
            <label>手机号码</label>
            <input id="phone" type="number" maxlength="11"  placeholder="请输入对方的手机号">
        </div>
        <div class="mui-input-row">
            <label>验证码</label>
            <input id="phoneCode" type="number" maxlength="6"  placeholder="请输入验证码">
            <span id="send">发送验证码</span>
        </div>
        <div class="mui-input-row">
            <label>验证码</label>
            <input id="pwd" type="number" maxlength="6"  placeholder="请设置对方的密码">
        </div>
    </form>
    <div style="height: 15px;"></div>
    <div class="mui-button-forms">
        <button type="button" id="submit" class="mui-btn mui-btn-primary mui-btn-block">确定</button>
    </div>
</div>
<script src="../../js/mui/js/mui.min.js"></script>
<script src="../../js/common/crypto-js.js"></script>
<script src="../../js/common/common.js"></script>
<script>
    // 60s倒计时
    var wait=60;
    var flag =true;
    function time(o) {
        if (wait == 0) {
            o.removeAttribute("disabled");
            o.innerHTML="发送验证码";
            wait = 60;
            flag=true;
        } else {
            flag = false;
            o.setAttribute("disabled", true);
            o.innerHTML="重新发送(" + wait + ")";
            wait--;
            setTimeout(function () {
                    time(o)
                },
                1000)
        }
    }

    mui.ready(function () {

        // 倒计时
        mui(".mui-input-row").on('tap', "#send", function () {
            if(flag){
                time(this);
                console.log("11")
            }else{

                console.log("22")
            }
        })

        // 步骤2:提交
        mui(".mui-button-forms").on("tap","#submit",function () {
            // 数据
            var phone = mui("#phone")[0].value;
            var phonecode = mui("#phoneCode")[0].value;
            var pwd = mui("#pwd")[0].value;
            var data = {
                phone:phone,
                phonecode:phonecode,
                pwd:pwd,
            }
            console.log('data',data)
            if(phone.length !=11){
                mui.alert("请输入对方的手机号"); return;
            }
            if(!phonecode){
                mui.alert("请输入验证码"); return;
            }
            if(pwd.length <6){
                mui.alert("请到少输入6位密码"); return;
            }

            console.log('data',data)
            // 执行提交
            // request("bind.do",data,function (res) {
            // })
        })
    })
</script>
</body>
</html>